Message-ID: <12338464.1075862460589.JavaMail.evans@thyme>
Date: Fri, 9 Nov 2001 13:59:43 -0800 (PST)
From: paulo.issler@enron.com
To: j.kaminski@enron.com, pinnamaneni.krishnarao@enron.com, 
	vasant.shanbhogue@enron.com, zimin.lu@enron.com, 
	tanya.tamarchenko@enron.com, zimin.lu@enron.com, bob.lee@enron.com, 
	alex.huang@enron.com
Subject: HJM simulation
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-From: Issler, Paulo </O=ENRON/OU=NA/CN=RECIPIENTS/CN=PFISSLE>
X-To: Kaminski, Vince J </O=ENRON/OU=NA/CN=RECIPIENTS/CN=Vkamins>, Krishnarao, Pinnamaneni </O=ENRON/OU=NA/CN=RECIPIENTS/CN=Pkrishn>, Shanbhogue, Vasant </O=ENRON/OU=NA/CN=RECIPIENTS/CN=Vshanbh>, Lu, Zimin </O=ENRON/OU=NA/CN=RECIPIENTS/CN=Zlu>, Tamarchenko, Tanya </O=ENRON/OU=NA/CN=RECIPIENTS/CN=Ttamarc>, Lu, Zimin </O=ENRON/OU=NA/CN=RECIPIENTS/CN=Zlu>, Lee, Bob </O=ENRON/OU=NA/CN=RECIPIENTS/CN=Blee5>, Huang, Alex </O=ENRON/OU=NA/CN=RECIPIENTS/CN=Ahuang2>
X-cc: 
X-bcc: 
X-Folder: \VKAMINS (Non-Privileged)\Kaminski, Vince J\Inbox
X-Origin: Kaminski-V
X-FileName: VKAMINS (Non-Privileged).pst

Please find attached the code for the HJM simulation model for option pricing and other necessities.
The model takes as inputs prices and volatilities and generates a daily spot price grid and respective transition probabilities - a framework for pricing options of multiple kinds.
As it is, the model seems quite flexible and detailed. It takes care of fwd-fwd volatilities and uses different factor loadings for each month - this means that the model takes different PCAs as as the curve shrinks in time. Also, the user may define as many factors as the size of # of points in the fwd curve.
One interesting aspect is the way I evolved the spot price to provide convergence to the prompt month price as the month approaches its end. Before shocking prices (spot and fwds) I get the expected spot for the next day by linear interpolation with the prompt fwd. By ensuring convergence, however, the model creates a spot price vol that converges to the prompt month vol. The phenomena is illustrated in the spreadsheet example where I call the model for each day of the first month to calculate the respective daily expected prices and vols.
As usual, I put the whole project on o:\research\common\project\options\HJM. It is self-contained - no need for other files and the whole source code is there. To see the the spreadsheet you need to install the fwd-fwd vol function and the loading factor function. You will find these things on o:\research\custom. Note that this is not necessary to run the model itself. It just makes the spreadsheet more illustrative and the code more understandable.
Regarding the last, I tried as much as possible to make the code clear and lean hoping that you feel confortable with its pieces and usability.


         
These are the files:
	HJMsim.c - Main file
	HJM.c - Where the simulation is actully run
	Support.c - set of support functions for the simulation (fwd-fwd, PCA, etc...)
	NRC.c - set of NRC functions I used (changed variables from float to double)
	NRUTIL.c - modified to accomodate memory management of double tensors
 
Please let me know your opinion and the bugs.
Thanks. 